home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The 640 MEG Shareware Studio 5
/
The 640 Meg Shareware Studio CD-ROM Volume V (Data Express)(1994).ISO
/
amiga
/
tempdemo.lha
/
ProgrammersInfo
/
DSKEL-FR.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-05-22
|
4KB
|
170 lines
// SKEL-FAKE v1.0
// (FAKE REPORTER)
//**********************
//***** Includes *****
//**********************
#include <proto/all.h>
#include <stdio.h>
#include <string.h>
#include <tempest/headers.h>
//********************************
//***** Structures/Defines *****
//********************************
struct MyMessage
{
struct Message Msg;
struct User User;
char text[255];
char text1[255];
int car,Value,Data;
long LongValue;
int IntValue;
};
struct User User;
struct MsgPort *MyPort = NULL;
struct MyMessage *msg;
#define DROP if(EXIT_FLAG) CloseStuff();
void CloseStuff();
void pl(char outstring[]);
void input(char mstring[],int len);
int DOORIO();
int EXIT_FLAG, DOOR_DATA, DOOR_CAR, DOOR_VALUE, DOOR_VALUE1 = 0,first = 0;
char DOOR_MSG [255],DOOR_MSG1[255],MyName[255],st[100];
//******************
//***** Main *****
//******************
void main(int argc,char *argv[])
{
char string1[255],string2[255];
register int fd;
if(!DoorStart(argv[1])) { PutStr("[os2] Tempest Door\n"); exit(0); }
pl("\f
[
DSKEL-FR v1.2
]
Fake Reporter By The SkeletoN
[
01-01-93
]\r\n");
pl("
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n");
CONTINUE:
pl("
[
Q = Quit
]
Enter Filename of Fake:
");
input(string1,12);
DROP;
if(string1[0] == ' ')
CloseStuff();
if(string1[1] == NULL)
if((string1[0] == 'q') || (string1[0] == 'Q'))
CloseStuff();
strcpy(string2,"FAKES:");
strcat(string2,string1);
fd=Open(string2,MODE_NEWFILE);
Close(fd);
goto CONTINUE;
}
//*************************
//***** Close Stuff *****
//*************************
void CloseStuff()
{ DOOR_DATA=99; strcpy(DOOR_MSG,'\0'); DOORIO();
while(msg=(struct MyMessage *)GetMsg(MyPort)) ReplyMsg((struct Message *)msg);
if(MyPort) DeletePort(MyPort);
exit(0); }
//************************
//***** Door Start *****
//************************
DoorStart(char node[])
{
struct MsgPort *HisPort;
EXIT_FLAG = 0;
strcpy(st,node);
strcat(st,":TEMPEST_DOOR");
HisPort = FindPort(st);
if(HisPort==NULL) return (FALSE);
strcpy(MyName,node);
strcat(MyName,":DOOR_PORT");
MyPort = CreatePort(MyName,0L);
if(MyPort==NULL)
{
PutStr("Cant open port");
return(int)FALSE;
}
DOORIO();
return (int)TRUE;
}
//********************
//***** DoorIO *****
//********************
int DOORIO()
{
struct MsgPort *HisPort;
struct MyMessage message;
int UPDATE;
if(EXIT_FLAG) return 0;
UPDATE=0;
HisPort = FindPort(st);
if(HisPort!=NULL)
{
message.Msg.mn_Node.ln_Type = NT_MESSAGE;
message.Msg.mn_Length = sizeof(message);
message.Msg.mn_ReplyPort = MyPort;
if(first)CopyMem(&User,&message.User,sizeof(struct User));
message.car = 0;
message.Data = DOOR_DATA;
message.Value = DOOR_VALUE;
message.IntValue = DOOR_VALUE1;
strcpy(message.text,DOOR_MSG);
strcpy(message.text1,DOOR_MSG1);
PutMsg((struct MsgPort *)HisPort,(struct Message *)&message);
Wait(1 << MyPort->mp_SigBit);
GetMsg(MyPort);
DOOR_DATA = message.Data;
DOOR_VALUE = message.Value;
DOOR_VALUE1 = message.IntValue;
strcpy(DOOR_MSG,message.text);
strcpy(DOOR_MSG1,message.text1);
CopyMem(&message.User,&User,sizeof(struct User));
first=1;
UPDATE=0;
if(message.car) EXIT_FLAG=1;
}
return 0;
}
//*******************
//***** Input *****
//*******************
void input(char mstring[],int len)
{ DOOR_DATA=40; DOOR_VALUE=len; strcpy(DOOR_MSG,mstring); DOORIO();
strcpy(mstring,DOOR_MSG); strcpy(DOOR_MSG,'\0'); strcpy(DOOR_MSG1,'\0'); }
//*****************************
//***** PL (Print Line) *****
//*****************************
void pl(char outstring[])
{ DOOR_DATA=1; strcpy(DOOR_MSG,outstring); DOORIO(); }